<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用款申请列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">

    <style>
        .table > tbody > tr > td {
            height: 48px;
            max-height: 44px;
            overflow: hidden;
        }

        .table > tbody > tr > td span {
            max-height: 44px;
            line-height: 22px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }

        .saveModle {
            width: 500px;
            height: 300px;
            position: fixed;
            top: 50%;
            left: 50%;
            margin-left: -250px;
            margin-top: -150px;
            background: #fff;
            border-radius: 10px;
            z-index: 1978;
            display: none;
            border: 1px solid #cfcfcf;
        }

        .saveModle .top {
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            font-weight: bold;
            color: #fff;
            padding-left: 7px;
            border-bottom: 1px solid #cfcfcf;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            background: #4293e4;
            position: relative;
        }

        .saveModle .top .title {
            height: 32px;
            line-height: 32px;
            font-size: 14px;
            font-weight: bold;
            color: #fff;
            /* float: left; */
            width: 56px;
            background: #fff;
            background: #4293e4;
            margin: 0 auto;
        }

        .saveModle .top .btn {
            font-size: 20px;
            width: 34px;
            height: 22px;
            line-height: 12px;
            display: inline-block;
            position: absolute;
            right: 0;
            top: 0px;
        }

        .saveModle .top .btn:hover {
            color: red;
        }

        .saveModle .saveBtn {
            margin: 0 auto;
            margin-top: 35px;
            display: block;

        }

        .form-control {
            /*height: auto;*/
            overflow: hidden;
        }

        span.lineOne {
            /*line-height: 28px !important;*/
            /*height: 28px;*/
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
            height: 48px;
            max-height: 44px;
            overflow: hidden;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .fixed-table_body tr:nth-of-type(odd) {
            background: #F9F9F9;
        }

        .tryStyle {
            width: 34px;
            height: 17px;
            line-height: 17px;
            font-size: 12px;
            top: 10px;
            right: -9px;
            position: absolute;
            border-radius: 50px;
            margin-top: 4px;
            background: #FF0000;
            color: #fff;
            margin-right: 5px;
            transform: scale(0.7);
            text-align: center !important;

        }
        .content {
            padding: 8px 8px 0 8px;
        }

        /*#tbList tr:nth-child(odd){*/
        /*background-color:#ECFAFD;*/
        /*}*/
    </style>
</head>

<body>
<section class="content"  id="app">
    <div class="div-td-content-more"><i></i></div>
    <div style="height: 25px;">
        <div class="pull-left" style="width: 120px;">
            <select id="selectCompany" class="form-control"
                    style="width: 100%;height: 25px;font-size: 12px;line-height: 25px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;"
                    v-model="searchParams.selectCom">
                <option value="">请选择公司</option>
                <option v-for="item in companyList" v-bind:value="item.id">{{item.name}}</option>
            </select>
        </div>
        <div class="pull-left" style="width:120px;margin-left:10px;">
            <select v-model="searchParams.type" class="form-control"
                    style="height:25px;font-size:12px;line-height:25px;padding-top:0px;padding-bottom:0px;padding-left:6px;">
                <option value="" selected>款项用途
                </option>
                <option v-for="(item,i) in typeList" v-bind:value="item.name">{{item.name}}
                </option>
            </select>
        </div>
        <div class="pull-left" style="width:120px;margin-left:10px;">
            <select v-model="searchParams.auditFlag" class="form-control"
                    style="height:25px;font-size:12px;line-height:25px;padding-top:0px;padding-bottom:0px;padding-left:6px;">
                <option v-for="(item,i) in auditFlagList" v-bind:value="item.value">{{item.name}}
                </option>
            </select>
        </div>
        <input class="form-control pull-left input-sm" type="text" @keyup.enter="search"
               placeholder="申请人"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.createUserName"/>
        <input class="form-control pull-left input-sm" type="text" @keyup.enter="search"
               placeholder="用款金额"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.money"/>
        <input class="form-control pull-left input-sm" type="text" @keyup.enter="search"
               placeholder="关键字"
               style="width: 120px;margin-left: 10px;"
               v-model="searchParams.key"/>
        <button type="button" class="btn oaBtn btn-sm" @keyup.enter="search" @click="search"
                style="margin-left: 10px;min-width: 45px;">
            查询
        </button>
        <button type="button" v-if="showBtn('addApply')" class="btn oaBtn pull-right btn-sm"
                style="margin-right: 20px"
                @click="gotoDetail(0,'edit',1)"/>
        新增申请</button>

        <!--<button type="button" class="btn oaBtn pull-right btn-sm"-->
        <!--style="margin-left: 10px;height: 24px;margin-right: 8px;"-->
        <!--v-if="returnFlag && wyp && showABtn('','waitPay') " @click="addAudit">-->
        <!--申请付款-->
        <!--</button>-->
        <!--<button type="button" v-if="showBtn('submitPay')" class="btn oaBtn pull-right btn-sm"-->
        <!--style="margin-right: 20px"-->
        <!--@click="submitPay"/>-->
        <!--申请付款</button>-->
        <!--<button type="button" v-if="showBtn('payAudit')" class="btn oaBtn pull-right btn-sm"-->
        <!--style="margin-right: 20px"-->
        <!--@click="payAudit('5')"/>-->
        <!--驳回付款</button>-->
        <!--<button type="button" v-if="showBtn('payAudit')" class="btn oaBtn pull-right btn-sm"-->
        <!--style="margin-right: 20px"-->
        <!--@click="payAudit('4')"/>-->
        <!--同意付款</button>-->

        <div class="clearfix"></div>
        <!-- /.box-tools -->
    </div>
    <div class="box-body no-padding iframeMoney" style="overflow: auto;" >
        <div id="progress" class="wyui-progress"></div>
        <div class="fixed-table-box head-fixed " style="margin-top: 10px;">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <thead>
                    <tr>
                        <th style="width:20px;">
                            <div class="table-cells">
                                <input type="checkbox" id="checkAll" v-model="isCheckedAll"
                                />
                            </div>
                        </th>
                        <th style="width: 80px;">
                            <div class="table-cells">公司</div>
                        </th>
                        <th style="width: 160px;">
                            <div class="table-cells">系统流水单号</div>
                        </th>
                        <th style="width: 120px;">
                            <div class="table-cells">款项用途</div>
                        </th>
                        <th style="width: 55px;">
                            <div class="table-cells">申请人</div>
                        </th>
                        <th>
                            <div class="table-cells">用款事由</div>
                        </th>
                        <th style="width: 80px;">
                            <div class="table-cells">用款金额</div>
                        </th>
                        <th style="width: 140px;">
                            <div class="table-cells">申请日期/付款日期</div>
                        </th>
                        <th style="width: 100px;">
                            <div class="table-cells">当前状态</div>
                        </th>
                        <th style="width: 120px;">
                            <div class="table-cells">操作</div>
                        </th>
                        <th style="width: 17px;">
                            <div class="table-cells"></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeFixedMoney"  id="scrollDiv">
                <table class="fixed-table_body table-hover" cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <tbody id="tbList">
                    <tr v-for="(item,i) in list">
                        <!--&lt;!&ndash;-->
                        <td style="width:20px;">
                            <input type="checkbox" enabled="isEnable(item)" v-model="item.checked"
                                   @click="checked(item)" :checked="isArray(item.id)"/>
                        </td>
                        <td style="width: 80px;">{{item.orgName.split('-')[0]}}</td>
                        <td style="width: 160px;">{{item.seriesNumber}}</td>
                        <td style="width: 120px;">
                            <span>{{item.type}}</span>
                            <span v-if="item.urgentFlag == '1' && item.auditFlag == '3' " style="color: #fff;"
                                  class="tryStyle">紧急
                            </span>
                            <span v-else></span>
                        </td>
                        <td style="width: 55px;">{{item.createUserName}}</td>
                        <td style="text-align:left;"><span class="lineOne">{{item.description}}</span></td>
                        <td style="width: 80px;">{{fmoney(item.money)}}</td>
                        <td style="width: 140px;">
                            <span v-if="item.auditFlag=='6'||item.auditFlag==6">
                                {{formatDate(item.payDate)}}
                            </span>
                            <span v-else>{{item.createTime?formatDate(item.createTime):formatDate(item.updateTime)}}</span>
                        </td>
                        <td v-html="convertAuditFlagToName(item)" style="width: 100px;">
                        </td>
                        <!--</template>-->
                        <td style="width: 120px;">
                            <a href="javascript:void(0);" v-if="showABtn(item,'edit')"
                               @click="gotoDetail(item,'edit',0)">&nbsp;编辑&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'reEdit')"
                               @click="gotoDetail(item,'edit',0)">&nbsp;重新编辑&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'copier')"
                               @click="getCopier(item.id)" style="display: block;">&nbsp;修改抄送人&nbsp;</a>

                            <a href="javascript:void(0);" v-if="showABtn(item,'edit')"
                               @click="removeById(item.id,i)">&nbsp;删除&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'browser')"
                               @click="gotoDetail(item,'browser',0)">&nbsp;查看&nbsp;</a>
                            <a href="javascript:void(0);" v-if="showABtn(item,'audit')"
                               @click="gotoDetail(item,'applyAudit',0)">&nbsp;审核&nbsp;</a>
                            <!--<a href="javascript:void(0);" v-if="showABtn(item,'payAudit')"-->
                            <!--@click="gotoDetail(item,'payAudit',0)">&nbsp;审核&nbsp;</a>-->
                            <a href="javascript:void(0);" v-if="showABtn(item,'pay')"
                               @click="gotoDetail(item,'pay',0)">&nbsp;付款&nbsp;</a>
                            <!--<a href="javascript:void(0);" v-if="showABtn(item,'waitAudit')"-->
                            <!--@click="gotoDetail(item.id,'waitAudit',0)"-->
                            <!--style="color:red;">&nbsp;审核&nbsp;</a>-->
                            <!--<a href="javascript:void(0);" v-if="showABtn(item,'waitPay')"-->
                            <!--@click="gotoDetail(item,'waitPay',0)"-->
                            <!--style="color:#2a8cec;">&nbsp;申请付款&nbsp;</a>-->
                        </td>
                        <template v-if="list.length>=8">
                            <td style="width: 0px;"></td>
                        </template>
                        <template v-else>
                            <td style="width: 17px;" ></td>
                        </template>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!--<table class="table table-hover text-center table-striped">-->
        <!--<thead>-->
        <!--<tr>-->
        <!--&lt;!&ndash;v-if="pageType=='pay'" 2018-03-12 09:44:21更改用款:增加左侧勾选框&ndash;&gt;-->
        <!--<th style="width:20px;">-->
        <!--<input type="checkbox" id="checkAll" v-model="isCheckedAll"-->
        <!--v-if="pageType=='pay'"/>-->
        <!--</th>-->
        <!--<th style="width: 80px;">公司</th>-->
        <!--<th style="width: 160px;">流水单号</th>-->
        <!--<th style="width: 80px;">款项用途</th>-->
        <!--<th style="width: 60px;">申请人</th>-->
        <!--<th>用款事由</th>-->
        <!--<th style="width: 70px;">用款金额</th>-->
        <!--<th style="width: 140px;">申请日期</th>-->
        <!--<th style="width: 100px;">当前状态</th>-->
        <!--<th style="width: 120px;">操作</th>-->
        <!--</tr>-->
        <!--</thead>-->
        <!--<tbody id="tbList">-->
        <!--<tr v-for="(item,i) in list">-->
        <!--&lt;!&ndash;&lt;!&ndash;&ndash;&gt;-->
        <!--<td style="width:20px;"><input type="checkbox"-->
        <!--enabled="isEnable(item)"-->
        <!--v-model="item.checked"/>-->
        <!--</td>-->
        <!--&lt;!&ndash;已通过或已付款变灰&ndash;&gt;-->
        <!--&lt;!&ndash;<template v-if="(item.auditFlag==2 && item.returnType==0) || item.auditFlag==6">&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.orgName.split('-')[0]}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.seriesNumber}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.type}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.createUserName}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c;text-align:left;"><span>{{item.description}}</span>&ndash;&gt;-->
        <!--&lt;!&ndash;</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.money}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c">{{item.createTime}}</td>&ndash;&gt;-->
        <!--&lt;!&ndash;<td style="color: #8c8c8c" v-html="convertAuditFlagToName(item)">&ndash;&gt;-->
        <!--&lt;!&ndash;</template>&ndash;&gt;-->
        <!--&lt;!&ndash;<template v-else>&ndash;&gt;-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.orgName.split('-')[0]}}</td>-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.seriesNumber}}</td>-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.type}}</td>-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.createUserName}}</td>-->
        <!--<td style="text-align:left;"><span class="lineOne">{{item.description}}</span></td>-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.money}}</td>-->
        <!--<td style="word-break:keep-all;/* 不换行 *//* 不换行 */">{{item.createTime?formatDate(item.createTime):formatDate(item.updateTime)}}</td>-->
        <!--<td v-html="convertAuditFlagToName(item)" style="word-break:keep-all;/* 不换行 *//* 不换行 */">-->
        <!--</td>-->
        <!--&lt;!&ndash;</template>&ndash;&gt;-->
        <!--<td>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'edit')"-->
        <!--@click="gotoDetail(item.id,'edit',0)">&nbsp;编辑&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'reEdit')"-->
        <!--@click="gotoDetail(item.id,'edit',0)">&nbsp;重新编辑&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'copier')"-->
        <!--@click="getCopier(item.id)" style="display: block;">&nbsp;修改抄送人&nbsp;</a>-->

        <!--<a href="javascript:void(0);" v-if="showABtn(item,'edit')"-->
        <!--@click="removeById(item.id,i)">&nbsp;删除&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'browser')"-->
        <!--@click="gotoDetail(item.id,'browser',0)">&nbsp;查看&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'audit')"-->
        <!--@click="gotoDetail(item.id,'applyAudit',0)">&nbsp;审核&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'payAudit')"-->
        <!--@click="gotoDetail(item.id,'payAudit',0)">&nbsp;审核&nbsp;</a>-->
        <!--<a href="javascript:void(0);" v-if="showABtn(item,'pay')"-->
        <!--@click="gotoDetail(item.id,'pay',0)"-->
        <!--style="color:red;">&nbsp;付款&nbsp;</a>-->
        <!--</td>-->
        <!--</tr>-->
        <!--</tbody>-->
        <!--</table>-->

    </div>
    <div class="oa-pager text-center" style="margin-top: 5px;">
        共
        <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
        <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
        <span class="oa-pager-button" id="first">首页</span>
        <span class="oa-pager-button" id="prev">上一页</span>
        <span class="oa-pager-button" id="next">下一页</span>
        <span class="oa-pager-button" id="last">尾页</span>
    </div>
    <div class="saveModle">
        <div class="top">
            <div class="title">修改抄送人</div>
            <div class="btn" v-on:click="closeModle"> x</div>
        </div>
        <div id="header" class="header box-body" style="padding: 25px 20px;padding-bottom: 0;">
            <div class="form-group">
                <label for="txtCopier" id="aCopiers" tabindex="-1">抄送人</label>
                <div class="userbox form-control" id="copiers" style="height: 100px"
                     v-on:click.stop="inputFocus('txtCopier')">
                    <div v-for="(user,i) in money.copiers" class="user"
                         v-bind:class="{ select: copierSelectedIdx == i }"
                         v-on:click="selectUser(i,'copierSelectedIdx')">{{user.copyPersonName}};
                    </div>
                    <input type="text" id="txtCopier"
                           @keyup.delete="deleteUser('copiers','copierSelectedIdx',$event)"/>
                </div>
            </div>
        </div>
        <input type="button" value="保存" class="saveBtn btn oaBtn" @click="saveGo">
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>
<script type="text/javascript" src="/dist/js/pages/common/changeMoneyToChinese.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/js/pages/apply/money/class.js?v1.0"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script type="text/javascript">
    function refresh() {
        $.wyui.page.queryParams.requestPage = 1;
        $.wyui.page.getByPage();
        //用款申请红点提示
        top.getRedHot();
    }

    var app = new Vue({
        el: '#app',
        data: {
            canPay:'',
            wyp: false,
            returnFlag:false,
            auditFlagList: [
                {value: '', name: '审核状态'},
                {value: '-1', name: '未提交'},
                {value: '0', name: '审核中'},
                {value: '1', name: '已通过'},
                {value: '2', name: '已驳回'},
                {value: '4', name: '待付款'},
                {value: '6', name: '已付款'}
            ],
            typeList:[],
            companyList: [],
            searchParams: {
                selectCom: "",
                userId: getCurrentUser().id,
                type: '',
                auditFlag: '',
                createUserName: '',
                money: '',
                key: '',
                isFuKSQR:'',
                isZiJin:''
            },
            pageType: "apply",//apply:用款申请，pay:付款审核
            isCheckedAll: false,
            currentUser: getCurrentUser(),
            list: [],
            selectIds: [],
            rightOpENames: [],
            copierSelectedIdx: -1,
            money: {
                main: {
                    id: ''
                },
                copiers: [],
            },
            payAuditors: []
        },
        watch: {
//            isCheckedAll: function (val) {
//                for (var i = 0; i < this.list.length; i++) {
//                    var item = this.list[i];
//                    item.checked = this.isCheckedAll;
//                    this.selectIds.push(item.id);
//                    console.log(this.selectIds.push(item.id))
//                }
//            },
            isCheckedAll: function (isCheck) {
                if (isCheck) {
                    for (var i = 0; i < this.list.length; i++) {
                        var item = this.list[i];
                        item.checked = this.isCheckedAll;
                        this.selectIds.push(item.id);
                    }
                } else {
                    this.selectIds = [];
                    for (var i = 0; i < this.list.length; i++) {
                        var item = this.list[i];
                        item.checked = this.isCheckedAll;
                    }
                }
            }
        },
        methods: {
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            isEnable: function (item) {
                return true;
            },
            closeModle: function () {
                $(".saveModle").hide();
            },
            inputFocus: function (id) {
                $("#" + id).focus();
            },
            selectUser: function (i, prop) {
                this.copierSelectedIdx = -1;
                this[prop] = i;
            },
            unselectUser: function () {
                this.copierSelectedIdx = -1;
            },
            formatDate: function (now) {
//                return  NewDate(now).Format(TimeFormat.pcList)
                return new Date(now).Format(TimeFormat.pcList)
            },
            deleteUser: function (prop, idx, event) {
                if (event.keyCode == 46 || event.keyCode == 8 && event.target.value == "") {
                    if (this[idx] > -1) {
                        this.money[prop].splice(this[idx], 1);
                        this.copierSelectedIdx = -1;
                    } else {
                        this[idx] = this.money[prop].length - 1;
                    }
                }
            },
            payAudit: function (auditFlag) {
                var ids = new Array();
                for (var i = 0; i < this.list.length; i++) {
                    if (this.list[i].checked && this.list[i].auditFlag == '3' && this.list[i].currentAuditorId == getCurrentUser().id) {
                        ids.push(this.list[i].id);
                    } else {
                        this.list[i].checked = false;
                    }
                }
                if (ids.length == 0) {
                    alert("请选择要提交的付款记录");
                    return;
                }
                $.wyui.postMethod(urlConfig.apply.money.payAudit, {
                    ids: ids.join(','),
                    userId: getCurrentUser().id,
                    auditFlag: auditFlag
                }, function () {
                    alert("审核成功");
                    $.wyui.page.getByPage();
                });
            },
            submitPay: function () {
                var ids = new Array();
                for (var i = 0; i < this.list.length; i++) {
                    if (this.list[i].checked && this.list[i].auditFlag == '1') {
                        ids.push(this.list[i].id);
                    } else {
                        this.list[i].checked = false;
                    }
                }
                if (ids.length == 0) {
                    alert("请选择要提交的付款记录");
                    return;
                }
                $.dialog({
                    content: 'url:configPayAuditor.html?ids=' + ids.join(',') + '&t=' + new Date(),
                    title: '配置付款审核人',
                    width: 600,
                    height: 300,
                    max: false,
                    min: false,
                    lock: true
                });
            },
            convertAuditFlagToName: function (item) {
                //auditFlag:-1,0,1,2,3,4,5,6
                switch (item.auditFlag) {
                    case "-1":
                        return "未提交";
                        break;
                    case "0":
                        if (item.currentAuditorId == getCurrentUser().id) {
                            return "<span style='color:red;'>待-" + item.currentAuditorName + "-审核</span>";
                        } else {
                            return "待-" + item.currentAuditorName + "-审核";
                        }
                        break;
                    case "1":
                        return "待申请付款";
                        break;
                    case "2":
                        return "用款已驳回";
                        break;
                    case "3":
//                        if (item.currentAuditorId == getCurrentUser().id) {
////                            return "<span style='color:red;'>待-" + item.currentAuditorName + "-付款审核</span>";
//                            return "付款审核中";
//                        } else {
//                            return "待-" + item.currentAuditorName + "-审核";
//                        }
                        return "付款审核中";
                        break;
                    case "4":
//                        var str='待付款';
//                        if(server.fwq){
//                            if(server.fwq=="wyp"){
//                                str= "待申请付款";
//                            }
//                        }
                        var roleName = currentUser.roleName;
                        if(roleName.indexOf("财务")>-1){
                            return "<span style='color:red;'>" + "待付款</span>";
                        }else {
                            return "待付款";
                        }
                        break;
                    case "5":
                        return "付款已驳回";
//                        return  "待申请付款";
                        break;
                    case "6":
                        return "已付款";
                        break;
                    default :
                        break;
                }
            },
            showABtn: function (item, btnName) {
                switch (btnName) {
                    case 'browser':
                        switch (item.auditFlag) {
                            case '-1':
                                return false;
                                break;
                            case '0':
                                return currentUser.id != item.currentAuditorId;
                                break;
                            case '3':
//                                return currentUser.id != item.currentAuditorId;
//                                break;
                            case '1':
                            case '2':
                            case '5':
                            case '6':
                                return true;
                            case '4':
                                return parseInt(this.canPay) == 0;
                                break;
                        }
                        return true;
                        break;
                    case 'edit':
                        return item.auditFlag == '-1' && item.createUserId == currentUser.id;
                        break;
                    case 'reEdit':
                        return (item.auditFlag == '2' && item.createUserId == currentUser.id && item.returnType == 1) || (item.auditFlag == '5' && item.createUserId == currentUser.id);
                        break;
                    case 'audit':
                        return item.auditFlag == '0' && currentUser.id == item.currentAuditorId;
                        break;
                    case 'payAudit':
                        return item.auditFlag == '3' && currentUser.id == item.currentAuditorId;
                        break;
                    case 'pay':
                        return  item.auditFlag == '4' && parseInt(this.canPay) > 0;
                    case 'waitAudit':
                        return item.auditFlag == '3' && currentUser.id == item.currentAuditorId;
                    case 'returnMoney':
                        return true;
//                        return item.auditFlag == '6' && parseInt(item.canPayFlag) > 0 && item.isRefund == '1' ;
                    case 'copier':
                        return item.createUserId == getCurrentUser().id;
                    case 'waitPay':
                        return ($.inArray('waitPay', this.rightOpENames) > -1);
                    default:
                        break;
                }
            },
            showBtn: function (btnName) {
                switch (btnName) {
                    case "submitPay":
                        return this.pageType == 'pay' && ($.inArray('submitPay', this.rightOpENames) > -1);
                        break;
                    case "addApply":
                        return this.pageType == 'apply';
                        break;
                    case "payAudit":
                        if (this.pageType == 'apply') {
                            return false;
                        }
                        var result = false;
                        for (var i = 0; i < this.list.length; i++) {
                            if (this.list[i].currentAuditorId == getCurrentUser().id) {
                                result = true;
                                break;
                            }
                        }
                        return result;
                        break;
                    default:
                        break;
                }
            },
            gotoDetail: function (item, pageType, isAdd) {
                var id = item.id;
                if (pageType == 'edit' && isAdd == 1) {
                    for (var i = 0; i < this.list.length; i++) {
                        if (this.list[i].checked && this.list[i].createUserId == getCurrentUser().id) {
                            id = this.list[i].id;
                            break;
                        }
                    }
                }
                $.dialog({
                    content: 'url:detail.html?id=' + id + '&pageType=' + pageType + "&isAdd=" + isAdd + "&t=" + new Date(),
                    title: isAdd == "1" ? getCurrentUser().companyName + '用款申请' : item.title,
                    width: 904,
                    height: 525,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            search: function () {
                var that = this;
                var data = {
                    'companyId': that.searchParams.selectCom,
                    'auditFlag': that.searchParams.auditFlag,
                    'money': that.searchParams.money.replace(/,/g, ""),
                    'key': that.searchParams.key,
                    'type': that.searchParams.type,
                    'createUserName': that.searchParams.createUserName,
                    'userId': that.searchParams.userId,
                    'isFuKSQR': that.searchParams.isFuKSQR,
                    'isZiJin': that.searchParams.isZiJin
                };
                $.wyui.page.queryParams.requestPage = 1;
                /*$.extend($.wyui.page.queryParams, this.searchParams);*/
                $.extend($.wyui.page.queryParams, data);
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            removeById: function (id, i) {
                if (confirm('确认要删除吗？')) {
                    var that = this;
                    $.wyui.postMethod(urlConfig.apply.money.removeById, {id: id}, function (result) {
                        that.list.splice(i, 1);
                    });
                }
            },
            getCopier: function (id) {
                var that = this;
                that.money.main.id = id;
                $.wyui.postMethod(urlConfig.apply.copier.moneycopier, {moneyId: id}, function (result) {
                    console.log(result);
                    that.money.copiers = result;
                    $(".saveModle").show();
                });

            },
            gotoReturnMoney: function (id) {
                var H = $(window).height() - 50;
                $.dialog({
                    content: 'url:returnMoney.html?id=' + id,
                    title: '填写用款说明',
                    width: 400,
                    height: 400,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            saveGo: function () {
                var that = this;
                console.log(that.copiers);
                $.wyui.postMethod(urlConfig.apply.copier.save, that.money, function (r) {
                    alert("保存成功");
                    $(".saveModle").hide();
                    $.wyui.page.getByPage();
                })

            },
            addAudit: function () {
                var that = this;
                console.log(that.selectIds)
                if (that.selectIds.length == 0) {
                    alert('请选择要提交的用款申请');
                    return;
                }
                var newList = [];
                for (var i = 0; i < that.list.length; i++) {
                    var data = that.list[i];
                    console.log(data)
                    if (parseInt(data.auditFlag) == 1 && $.inArray(data.id, that.selectIds) > -1) {
                        newList.push(data.id)
                    }
                }
                $.wyui.postMethod("/apply/getAuditors.json",
                    {companyId: getCurrentUser().companyId},
                    function (data) {
                        that.payAuditors = data;
                    },true);
                if (!confirm("确定要提交吗？")) {
                    return;
                }
                $.wyui.postMethod(urlConfig.apply.money.allCommit,
                    {userId: getCurrentUser().id, selectIds: newList.join("','"), auditors: that.payAuditors},
                    function (data) {
                        alert('提交成功');
                        refresh();
                        that.selectIds = '';
                        that.isCheckedAll = false;
                        that.payAuditors = [];
                    })

//                $.dialog({
//                    content: 'url:addAuditors.html?selectIds=' + newList.join("','") + "&userId=" + currentUser.id + '&pageType=edit' + "&isAdd=1" + "&t=" + new Date(),
//                    title: "",
//                    width: 600,
//                    height: 300,
//                    max: true,
//                    min: true,
//                    lock: true
//                });
            },
            isEnable: function (item) {
                return true;
            },
            checked: function (item) {
                var that = this;
                if ($.inArray(item.id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    console.log(that.selectIds.length)
                    for (var i = 0; i < that.selectIds.length; i++) {
                        if (that.selectIds[i] == item.id) {
                            that.selectIds.splice(i, 1);
                            console.log(that.selectIds)
                        }
                    }
                } else {
                    // 选中该checkbox
                    that.selectIds.push(item.id)
                }
            },
            isArray: function (id) {
                var that = this;
                if ($.inArray(id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    return true;
                } else {
                    // 选中该checkbox
                    return false;
                }
            },
        },
        mounted: function () {

            var that = this;
            if (server.fwq) {
                if (server.fwq == "wyp") {
                    that.wyp = true;
                }
            }

            $.wyui.postMethod("/aplType/getNameList.json", {modelName:'money'},function (data) {
                that.typeList=data.names;
                 console.log(that.typeList);
            });
            $.wyui.postMethod("/apply/getCanPay.json",{userId: getCurrentUser().id},
                function (data) {
                    console.log(data.canPayFlag)
                    that.canPay = data.canPayFlag;
                    console.log(that.canPay)
                },true);
            this.pageType = $.wyui.page.urlParams.pageType;
            $.wyui.postMethod(urlConfig.system.rightOp.getRightOpByUserId, {userId: getCurrentUser().id}, function (rightOps) {
                for (var i = 0; i < rightOps.length; i++) {
                    that.rightOpENames.push(rightOps[i].eName);
                }
                console.log('aaaa='+ that.rightOpENames)
                that.returnFlag=true;
                if($.inArray('waitPay', that.rightOpENames) > -1) {
                    that.searchParams.isFuKSQR = '1';
                }
                $.wyui.page.dataUrl = server.ip + urlConfig.apply.money.getByPage;
                $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
                $.extend($.wyui.page.queryParams, app.searchParams);
                $.wyui.page.getByPage();
            });
            $.wyui.postMethod("/company/getCompanyListByUserIdAndRegionId.json", {userId: getCurrentUser().id}, function (r) {
                console.log(r);
                that.companyList = r;
            });
            if (this.pageType == "apply") {
                this.auditFlagList = [
                    {value: '', name: '状态'},
                    {value: '-1', name: '未提交'},
                    {value: '0', name: '用款审核中'},
                    {value: '1', name: '待申请付款'},
                    {value: '2', name: '用款已驳回'},
                    {value: '3', name: '付款审核中'},
                    {value: '5', name: '付款已驳回'},
                    {value: '4', name: '待付款'},
                    {value: '6', name: '已付款'}
                ];
            } else {
                this.auditFlagList = [
                    {value: '', name: '状态'},
                    {value: '3', name: '审核中'},
                    {value: '4', name: '待付款'},
                    {value: '6', name: '已付款'}
                ];
            }
        },

    });


    $.wyui.page.getByPage_callback = function (records) {
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };

    $(function () {
        $(".saveModle").show();
        $("#txtCopier").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                var copierIds = new Array();
                for (var i = 0; i < app.money.copiers.length; i++) {
                    copierIds.push(app.money.copiers[i].copyPersonId);
                }
                if ($.inArray(user.id, copierIds) > -1) {
                    alert("收件人或抄送人重复");
                    $(this).val("");
                    return false;
                } else {
                    app.money.copiers.push({copyPersonId: user.id, copyPersonName: user.name});
                    $(this).val("");
                    return false;
                }
            },
            height: 210,
            width: 320,
            top: 0,
            left: 0
        });
        $(".saveModle").hide();
    });
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
//            alert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);

            }

            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }

    divscroll.onscroll = divScroll;
</script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
</body>
</html>